package com.ruoyi.mall.app.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.mall.app.service.DtsBrandService;
import com.ruoyi.mall.common.domain.DtsAddress;
import com.ruoyi.mall.common.domain.DtsBrand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.List;

@RestController
@RequestMapping("/api/index/brand")
public class DtsBrandController extends BaseController {

    @Autowired
    private DtsBrandService dtsBrandService;

    @GetMapping("/brandList")
    public AjaxResult brandList()
    {
        List<DtsBrand> dtsBrandList = dtsBrandService.selectAll();
        if (dtsBrandList != null){
            return success(dtsBrandList);
        }else {
            return error();
        }
    }

    @GetMapping("/brandById")
    public AjaxResult brandById(Long id)
    {
        DtsBrand dtsBrand = dtsBrandService.selectDtsBrandById(id);
        if (dtsBrand != null) {
            return success(dtsBrand);
        } else {
            return error();
        }
    }
}
